<%@ page language="java" import="java.util.*,com.ruohi.util.common.*" pageEncoding="UTF-8"%><%
	String tableName = "view_lotteried_history";
	String tablePrefix = Env.getInstance().getProperty("table_prefix");
	String fileds = "id,uuid,add_date,mem_no,mem_name,nick_name,lottery_level,email,tel,mobile,ship_address";
	String channelUUID = CommonString.getFormatPara(request.getParameter("channel_uuid"));
	String whereStr = " ";
	String orderByStr = " add_date desc ";
	
	Map enumMap = (Map)application.getAttribute("enumMap");
	Map jiangMap = CommonApplication.getEnumChildren("176", application);
	
%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title><%=Env.getInstance().getProperty("project_name") %></title>
	<link href="/plugin/ui/ligerUI/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
	<link href="/plugin/ui/ligerUI/ligerUI/skins/Gray/css/all.css" rel="stylesheet" type="text/css" />
	<link href="/plugin/ui/ligerUI/ligerUI/skins/ligerui-icons.css" rel="stylesheet" type="text/css" />
	<link href="/backend/style/style.css" rel="stylesheet" type="text/css" />
	<script src="/plugin/jquery/jquery.min.js" type="text/javascript"></script>
  </head>
  <body>
  	<div class="searchForm">
  		<div class="searchCondition">
  			<div class="searchList">
		  		<div class="searchLeft">用户名</div>
		  		<div class="searchRight">
		  			<input type="text" class="jr_text" name="mem_no" id="mem_no" />
		  		</div>
		  	</div>
		  	<div class="searchList">
		  		<div class="searchLeft">昵称</div>
		  		<div class="searchRight">
		  			<input type="text" class="jr_text" name="nick_name" id="nick_name" />
		  		</div>
		  	</div>
		  	<div class="searchList">
		  		<div class="searchLeft">真实姓名</div>
		  		<div class="searchRight">
		  			<input type="text" class="jr_text" name="mem_name" id="mem_name" />
		  		</div>
		  	</div>
		  	<div class="searchList">
		  		<div class="searchLeft">中奖类型</div>
		  		<div class="searchRight">
		  			<select name="lottery_level" id="lottery_level" class="jr_select">
		  				<option value="">选择中奖类型</option>
		  				<%=CommonForm.createSelect(jiangMap,"") %>
		  			</select>
		  		</div>
		  	</div>
  		</div>
  		<div class="searchBtn">
  			<input type="button" class="btn" onclick="doSearch();" value="查询" /><input type="button" style="margin-left: 5px;" class="btn" onclick="doClearForm();" value="重置" />
  		</div>
  	</div>
  	<div style="clear: left;"></div>
  	
	<div class="l-loading" style="display: block" id="pageloading"></div> 
	<div id="maingrid" style="margin: 0; padding: 0"></div>
	<div style="display: none;"></div>
  </body>
</html>
<script src="/plugin/ui/ligerUI/ligerUI/js/ligerui.min.js" type="text/javascript"></script>
<script src="/plugin/date/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
<script src="/backend/scripts/common.js" prefix="<%=tablePrefix %>" type="text/javascript"></script>
<script type="text/javascript">
	var grid;
	var windowWidth = 800;
	var windowHeight = 420;
	var channelUUID = '<%=channelUUID %>';
	var tableName = "<%=tableName %>";
	var fields = "<%=fileds %>";
	var whereStr = "<%=whereStr %>";
	var orderBy = "<%=orderByStr %>";
	var columnsArr = [];
	var url = "";
	var conditionStr = "";
	var params = [];
	jQuery(function() {
		params.push({'name':'enumNo','value':'106013'});
		grid = new Dev21sunGrid();
		jQuery("#pageloading").hide();
	});
	var is_showData = [{ is_show : 1 , text: '是' }, { is_show : 0 , text: '否'}];
	//列数组
	columnsArr =  [ 
		{ display : '用户名(昵称)', name : 'mem_no', align : 'left' , type : 'string' , width : 150, render:function(row){
			return row.mem_no + "(" + (row.nick_name==""||row.nick_name==null ? "无" : row.nick_name) + ")";
		}} ,
		{ display : '真实姓名', name : 'mem_name', align : 'center', width : 100, type:'string' },
		{ display : '抽奖日期', name : 'add_date', align : 'center' , type : 'date' , width : 100 } ,
		{ display : '中奖类型', name : 'lottery_level', align:'left', width:120, type:'string', render:function(row){
			return getEnum(row.lottery_level);
		} },
		{ display:'手机',name:'mobile',align:'center', width:100, type:'string' },
		{ display:'座机', name:'tel', align:'center', width:100, type:'string' },
		{ display : '邮箱', name : 'email', align : 'left' , type : 'string' , width : 150 },
		{ display:"商品邮寄地址", name:"ship_address", align:"left", type:"string", width:200 },
		{ display:"操作", align:"center", width:80, render:function(row){
			return "<a href=\"javascript://void(0);\" onclick=\"addAndEdit("+row.__index+");\">编辑</a>";
		} }
	];
	
	/*列表页条件查询*/
	function doSearch(){
		params = [];
		conditionStr = "";
		var mem_no = jQuery("#mem_no").val();
		if(''!=jQuery.trim(mem_no)){
			conditionStr += " and mem_no like '%"+mem_no+"%' ";
		}
		var mem_name = jQuery("#mem_name").val();
		if(''!=jQuery.trim(mem_name)){
			conditionStr += " and mem_name like '%"+mem_name+"%' ";
		}
		var nick_name = $.trim($("#nick_name").val());
		if(nick_name!=""){
			conditionStr += " and nick_name like '%" + nick_name + "%'";
		}
		var start_date = jQuery("#add_date_start").val();
		if(''!=jQuery.trim(start_date)){
			conditionStr += " and add_date > '"+start_date+"' ";
		}
		var end_date = jQuery("#add_date_end").val() ;
		if(''!=jQuery.trim(end_date)){
		    conditionStr += " and add_date < '"+end_date+"'" ;
		}
		var lottery_level = $("#lottery_level").val();
		if($.trim(lottery_level)!=""){
			conditionStr += " and lottery_level='" + lottery_level + "'";
		}
		params.push({'name':'enumNo','value':'106013'});
		params.push({'name':'tableName','value':tableName});
		params.push({'name':'fields','value':fields});
		params.push({'name':'whereStr','value':whereStr+conditionStr});
		params.push({'name':'orderBy','value':orderBy});
		grid.options.parms=params;
		grid.loadData();
	}
	
	function addAndEdit(index){
    	if(undefined==index){//如果是增加
			toolbarAdd({
				width:800,
				height:500,
				folderName:"gift.21-sun.com/gift_lotteried_history",
				fileName:"gift_lotteried_history",
				params:{
					channel_uuid:'<%=channelUUID%>'
				},
				title:"增加"
			});
    	}else{//如果是修改
	    	var row = grid.getRow(index);
			toolbarAdd({
				title:"编辑",
				width:800,
				folderName:"gift.21-sun.com/gift_lotteried_history",
				fileName:"gift_lotteried_history",
				height:500
			},row.uuid);
    	}
    }
</script>